package com.itheima.d4_jdk8_time;

import java.time.LocalDate;

public class Test1_LocalDate {
    public static void main(String[] args) {
        LocalDate ld = LocalDate.now();
        System.out.println(ld);

        int age = ld.getYear();
        System.out.println(age);



        // 修改日期
        LocalDate ld2 = ld.withYear(2020);
        System.out.println(ld2);
        System.out.println(ld);

        // 把某一个信息加 多少
        System.out.println(ld2.plusYears(2));
        // 减少多少
        System.out.println(ld2.minusYears(2));


        // 5获取指定日期的localDate 对象
        LocalDate ld3 = LocalDate.of(2020, 5, 5);
        LocalDate ld4 = LocalDate.of(2020, 5, 5);
        System.out.println(ld3);
        System.out.println(ld3.equals(ld4));
        System.out.println(ld3.isAfter(ld));
        System.out.println(ld3.isBefore(ld));




    }
}
